/***********************************************************************
 *
 * MODULE NAME:    rfcomm_proto.h
 * PROJECT CODE:   Bluestream host stack
 * DESCRIPTION:    RFCOMM Function Prototypes
 * MAINTAINER:     David Airlie
 * CREATION DATE:  1 May 2000
 *
 * SOURCE CONTROL: $Id: rfcomm_proto.h,v 1.2 2008/12/16 10:20:39 jianguo Exp $
 *
 * LICENSE:
 *     This source code is copyright (c) 2000-2002 RDA Microelectronics Inc.
 *     All rights reserved.
 *
 ***********************************************************************/
#ifndef _RDABT_RFCOMM_PROTO_H_
#define _RDABT_RFCOMM_PROTO_H_
/* This file is automatically generated with "make proto". DO NOT EDIT */
#include "rfcomm_types.h"
#include "rfcomm_core.h"
#include "rfcomm_pe.h"


/*The following definitions come from  port_ent_api.c  */
#if RDABT_RFCOMM_PE_SUPPORT==1
t_api rdabt_pe_layer_ctrl(u_int8 flags);
APIDECL1 t_api APIDECL2 PE_SrvRegisterPort(char *port, rdabt_t_rfcomm_schan *serv_chan, void (*port_callback)(rdabt_t_rfcomm_schan schan, t_bdaddr bd_addr, u_int8 connection_state));
APIDECL1 t_api APIDECL2 PE_SrvDeregisterPort(rdabt_t_rfcomm_schan schan);
APIDECL1 t_api APIDECL2 PE_SrvDisconnectPort(rdabt_t_rfcomm_schan schan);
APIDECL1 t_api APIDECL2 PE_CliConnectPort(t_bdaddr remote_bd_addr, rdabt_t_rfcomm_schan rem_schan, char *pName, void (*port_callback)(rdabt_t_rfcomm_schan schan, t_bdaddr bd_addr, u_int8 connection_state));
APIDECL1 t_api APIDECL2 PE_CliDisconnectPort(t_bdaddr remote_bd_addr, rdabt_t_rfcomm_schan serverchannel);
#endif

/*The following definitions come from  rfcomm_core.c  */

int rdabt_rfcomm_init(u_int32 flags);
int rdabt_rfcomm_core_init(u_int32 flags);
int rdabt_rfcomm_reset(void);
int rdabt_rfcomm_check_channel_state(rdabt_t_rfcomm_schan schan);
void rdabt_rfcomm_l2cap_connect_ind(u_int16 eventType, t_L2_ControlCallbackArgs *args);
int rdabt_rfcomm_add_l2cap_inst(struct rdabt_rfcomm_l2cap_inst *instance);
int rdabt_rfcomm_l2cap_cid_cmp(void *cmpin, void *compwith);
int rdabt_rfcomm_lookup_l2cap_inst_by_cid(rdabt_t_rfcomm_cid cid, struct rdabt_rfcomm_l2cap_inst **l2cap_inst_ptr);
int rdabt_rfcomm_l2cap_bdaddr_cmp(void *cmpin, void *compwith);
int rdabt_rfcomm_lookup_l2cap_inst_by_bd_addr(t_bdaddr bd_addr, struct rdabt_rfcomm_l2cap_inst **l2cap_inst_ptr);
int rdabt_rfcomm_remove_l2cap_inst(struct rdabt_rfcomm_l2cap_inst *l2cap_inst, int do_callback);
int rdabt_rfcomm_l2cap_remove_all_inst_helper(void *data, void *func_info);
int rdabt_rfcomm_remove_all_l2cap_inst(void);
int rdabt_rfcomm_schan_cmp(void *cmpin, void *compwith);
int rdabt_rfcomm_lookup_server_inst_by_schan(rdabt_t_rfcomm_schan schan, struct rdabt_rfcomm_server_inst **server_inst_ptr);
int rdabt_rfcomm_remove_server_inst_by_schan(rdabt_t_rfcomm_schan schan, struct rdabt_rfcomm_server_inst **server_inst_ptr);
/*int rdabt_rfcomm_remove_server_inst(struct rdabt_rfcomm_server_inst *server_inst);*/
int rdabt_rfcomm_remove_all_servers(void);
int rdabt_rfcomm_validate_and_lock_l2cap_inst_by_ptr(struct rdabt_rfcomm_l2cap_inst *l2cap_inst);

t_api rdabt_rfcomm_cc_data_ind(rdabt_t_rfcomm_dlci dlci0, rdabt_host_buf_t *buffer, void *multi_inst);
t_api rdabt_rfcomm_cc_cancel_timer(struct rdabt_rfcomm_dlc_inst *dlc0_inst);
t_api rdabt_rfcomm_cc_process_msc(struct rdabt_rfcomm_l2cap_inst *self, rdabt_host_buf_t *frame);
t_api rdabt_rfcomm_cc_process_pn(struct rdabt_rfcomm_l2cap_inst *self, rdabt_host_buf_t *frame);
t_api rdabt_rfcomm_cc_process_test(struct rdabt_rfcomm_l2cap_inst *self, rdabt_host_buf_t *frame);
int rdabt_rfcomm_tfunc_flow_dlci(void *data, void *func_info);
t_api rdabt_rfcomm_cc_process_fcon(struct rdabt_rfcomm_l2cap_inst *self, rdabt_host_buf_t *frame);
t_api rdabt_rfcomm_cc_process_fcoff(struct rdabt_rfcomm_l2cap_inst *self, rdabt_host_buf_t *frame);
t_api rdabt_rfcomm_cc_process_rls(struct rdabt_rfcomm_l2cap_inst *self, rdabt_host_buf_t *frame);
t_api rdabt_rfcomm_cc_process_rpn(struct rdabt_rfcomm_l2cap_inst *self, rdabt_host_buf_t *frame);
void rdabt_rfcomm_cc_timeout_cb(void *param);
t_api rdabt_rfcomm_cc_transmit_cmesg(struct rdabt_rfcomm_l2cap_inst *self, rdabt_host_buf_t *buffer, u_int8 cresp);

/*The following definitions come from  rfcomm_ctrl_frames.c  */

int rdabt_rfcomm_cc_create_test(rdabt_host_buf_t *frame, u_int8 cresp);
int rdabt_rfcomm_cc_destroy_test(rdabt_host_buf_t *frame);
int rdabt_rfcomm_cc_create_fcon(rdabt_host_buf_t *frame, u_int8 cresp);
int rdabt_rfcomm_cc_create_fcoff(rdabt_host_buf_t *frame, u_int8 cresp);
int rdabt_rfcomm_cc_create_nsc(rdabt_host_buf_t *frame, u_int8 cresp, u_int8 nscom, u_int8 nscomm_cr);
int rdabt_rfcomm_cc_create_rpn_req(rdabt_host_buf_t *frame, u_int8 cresp, rdabt_t_rfcomm_dlci dlci);
int rdabt_rfcomm_cc_create_rpn_comm(rdabt_host_buf_t *frame, u_int8 cresp, rdabt_t_rfcomm_dlci dlci ,rdabt_t_rfcomm_port_params *port_parameters);
int rdabt_rfcomm_cc_create_msc(rdabt_host_buf_t *frame, u_int8 cresp, rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_control_params *ctrl_params);
int rdabt_rfcomm_cc_create_rls(rdabt_host_buf_t *frame, u_int8 cresp, rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_line_stat_params line_stat_params);
int rdabt_rfcomm_cc_create_pn(rdabt_host_buf_t *frame, u_int8 cresp, rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_dlc_params *dlc_params);
int rdabt_rfcomm_cc_create_credit_pn(rdabt_host_buf_t *frame, u_int8 cresp, rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_dlc_params *dlc_params, u_int8 clbits, u_int8 kbits);

/*The following definitions come from  rfcomm_dlc_state.c  */

t_api rdabt_rfcomm_dlc_init(struct rdabt_rfcomm_l2cap_inst *l2cap_inst, rdabt_t_rfcomm_dlci dlci, struct rdabt_rfcomm_dlc_inst **instance, u_int8 locked);
int rdabt_rfcomm_dlc_do_event(struct rdabt_rfcomm_dlc_inst *instance, RDABT_RFCOMM_EVENT event, struct rdabt_rfcomm_event_info *info);
void rdabt_rfcomm_dlc_next_state(struct rdabt_rfcomm_dlc_inst *self, RDABT_RFCOMM_DLC_STATE state);
void rdabt_rfcomm_ack_timeout_cb(void *param);

/*The following definitions come from  rfcomm_entity_core.c  */

t_api rdabt_rfcomm_entity_init(u_int32 flags);
t_api rdabt_rfcomm_entity_shutdown(u_int32 flags);
int rdabt_rfcomm_entity_rfstart_ind_cb(t_bdaddr bd_addr, rdabt_t_rfcomm_start_sys_params *system_parameters, rdabt_t_rfcomm_accept accept, void *multi_inst);
t_api rdabt_rfcomm_entity_rfstart_conf_cb(t_bdaddr bd_addr, rdabt_t_rfcomm_start_sys_params *system_parameters, rdabt_t_rfcomm_accept accept, void *multi_inst);
int rdabt_rfcomm_open_multiplexer(t_bdaddr remote_bd_addr, void **multi_inst);
int rdabt_rfcomm_entity_connect_port(t_bdaddr remote_bd_addr, rdabt_t_rfcomm_schan rem_schan, rdabt_t_rfcomm_dlci *dlci, rdabt_t_rfcomm_dlc_params *dlc_params, struct rdabt_rfcomm_dlc_cb *cbs, void **multi_inst_ptr);
int rdabt_rfcomm_entity_remove_all_pending_conns(void);

/*The following definitions come from  rfcomm_frames.c  */

int rdabt_rfcomm_create_sabm(rdabt_host_buf_t *frame, rdabt_t_rfcomm_dlci DLCI, u_int8 pbit, u_int32 cresp);
int rdabt_rfcomm_create_ua(rdabt_host_buf_t *frame, rdabt_t_rfcomm_dlci DLCI, u_int8 fbit, u_int32 cresp);
int rdabt_rfcomm_create_dm(rdabt_host_buf_t *frame, rdabt_t_rfcomm_dlci DLCI, u_int8 fbit, u_int32 cresp);
int rdabt_rfcomm_create_disc(rdabt_host_buf_t *frame, rdabt_t_rfcomm_dlci DLCI, u_int8 fbit, u_int32 cresp);
int rdabt_rfcomm_create_uih(rdabt_host_buf_t *frame, rdabt_t_rfcomm_dlci DLCI, u_int32 cresp, u_int8 pfbit);  //zhu jianguo changed it. 2008.12.5
int rdabt_rfcomm_create_uih_credit(rdabt_host_buf_t *frame, rdabt_t_rfcomm_dlci DLCI, u_int32 cresp, u_int8 num_credits);
int rdabt_rfcomm_destroy_uih(rdabt_host_buf_t *frame);
int rdabt_rfcomm_add_fcs(rdabt_host_buf_t *frame, int fcs_len);
u_int8 rdabt_rfcomm_get_fcs(u_int8 *frame, int fcs_len);
int rdabt_rfcomm_rx_fcs(rdabt_host_buf_t *frame, int fcs_len);
int rdabt_rfcomm_dump_frame(rdabt_host_buf_t *frame, int tx);

/*The following definitions come from  rfcomm_l2cap.c  */

int rdabt_rfcomm_l2cap_init(struct rdabt_rfcomm_l2cap_inst **l2cap_inst_ptr, t_bdaddr bd_addr);
void rdabt_rfcomm_l2cap_data_ind_cb(u_int16 cid, rdabt_host_buf_t *p_buf);
void rdabt_rfcomm_l2cap_config_ind_cb(u_int8 eventType, t_L2_ControlCallbackArgs *args);
void rdabt_rfcomm_l2cap_config_cfm_cb(u_int8 eventType, t_L2_ControlCallbackArgs *args);
void rdabt_rfcomm_l2cap_flow_ind_cb(u_int8 eventType, t_L2_ControlCallbackArgs *args);
void rdabt_rfcomm_l2cap_disc_ind_cb(u_int16 eventType, t_L2_ControlCallbackArgs *args);
void rdabt_rfcomm_l2cap_disc_cfm_cb(u_int16 eventType, t_L2_ControlCallbackArgs *args);
void rdabt_rfcomm_l2cap_connect_cfm_cb(u_int8 eventType, t_L2_ControlCallbackArgs *args);
int rdabt_rfcomm_reg_dlc_instance(struct rdabt_rfcomm_l2cap_inst *self, rdabt_t_rfcomm_dlci dlci, struct rdabt_rfcomm_dlc_inst *instance);
int rdabt_rfcomm_dlc_dlci_cmp_helper(void *cmpin, void *compwith);
int rdabt_rfcomm_lookup_dlci_instance(struct rdabt_rfcomm_l2cap_inst *self, rdabt_t_rfcomm_dlci dlci, struct rdabt_rfcomm_dlc_inst **instance);
int rdabt_rfcomm_remove_dlc_instance(struct rdabt_rfcomm_l2cap_inst *self, rdabt_t_rfcomm_dlci dlci, struct rdabt_rfcomm_dlc_inst **ret_inst);
int rdabt_rfcomm_dlc_remove_all_helper(void *data, void *func_info);
int rdabt_rfcomm_remove_all_dlc_instance(struct rdabt_rfcomm_l2cap_inst *self, int do_release);
int rdabt_rfcomm_lookup_dlci_instance_and_lock(struct rdabt_rfcomm_l2cap_inst *self, rdabt_t_rfcomm_dlci dlci, struct rdabt_rfcomm_dlc_inst **instance);
int rdabt_rfcomm_free_dlc_instance(struct rdabt_rfcomm_dlc_inst *self);
/*The following definitions come from  rfcomm_l2cap_state.c  */

t_api rdabt_rfcomm_l2cap_do_event(struct rdabt_rfcomm_l2cap_inst *l2cap_inst, RDABT_RFCOMM_EVENT event, struct rdabt_rfcomm_event_info *info);
void rdabt_rfcomm_l2cap_next_state(struct rdabt_rfcomm_l2cap_inst *l2cap_inst, RDABT_RFCOMM_L2CAP_STATE state);
int rdabt_rfcomm_l2cap_process_data(struct rdabt_rfcomm_l2cap_inst *l2cap_inst, struct rdabt_rfcomm_event_info *info);
int rdabt_rfcomm_l2cap_dispatch_data(struct rdabt_rfcomm_dlc_inst *instance, struct rdabt_rfcomm_event_info *info);

/*The following definitions come from  rfcomm_pe.c  */

void rdabt_rfcomm_init_pe_struct(struct rdabt_rfcomm_pe_port *pe_info);
void rdabt_rfcomm_free_pe_struct(struct rdabt_rfcomm_pe_port *pe_info);
int rdabt_rfcomm_pe_connect_port(t_bdaddr remote_bd_addr, rdabt_t_rfcomm_schan rem_schan, const char *pName, rdabt_t_rfcomm_dlci *dlci, struct rdabt_rfcomm_pe_port **pe_info_ptr, u_int16 max_frame_size,  void (*port_callback)(rdabt_t_rfcomm_schan schan, t_bdaddr bd_addr, u_int8 connection_state));
t_api rdabt_rfcomm_pe_disconnect_remote_serverchannel(t_bdaddr remote_bd_addr, rdabt_t_rfcomm_schan serverchannel, struct rdabt_rfcomm_pe_port **pe_info_ptr);
int rdabt_rfcomm_pe_disconnect_local_server_channel(struct rdabt_rfcomm_pe_port **pe_info_ptr, rdabt_t_rfcomm_schan schan);
t_api port_ent_dlc_estab_ind_cb(t_bdaddr bd_addr, rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_dlc_params *dlc_params, void *multi_inst);
t_api port_ent_dlc_estab_conf_cb(t_bdaddr bd_addr, rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_dlc_params *dlc_params, rdabt_t_rfcomm_accept accept, void *multi_inst);
t_api rdabt_rfcomm_pe_alloc_schan(rdabt_t_rfcomm_schan *p_schan);
int rdabt_rfcomm_pe_add_port_entity(struct rdabt_rfcomm_pe_port *self);
int rdabt_rfcomm_pe_portnum_cmp(void *cmpin, void *compwith);
int rdabt_rfcomm_pe_remove_port_entity_by_portnum(struct rdabt_rfcomm_pe_port **port, u_int32 portnum);
int rdabt_rfcomm_pe_lookup_port_entity_by_portnum(struct rdabt_rfcomm_pe_port **port, u_int32 portnum);
int rdabt_rfcomm_pe_addrdlci_cmp(void *cmpin, void *compwith);
int rdabt_rfcomm_pe_lookup_port_entity_by_addr_and_dlci(struct rdabt_rfcomm_pe_port **port, t_bdaddr bdaddr, u_int8 dlci);
int rdabt_rfcomm_pe_remove_port_entity_by_addr_and_dlci(struct rdabt_rfcomm_pe_port **port, t_bdaddr bdaddr, u_int8 dlci);


int rdabt_rfcomm_entity_connect_port(t_bdaddr remote_bd_addr, rdabt_t_rfcomm_schan rem_schan, rdabt_t_rfcomm_dlci *dlci, rdabt_t_rfcomm_dlc_params *dlc_params, struct rdabt_rfcomm_dlc_cb *cbs, void **multi_inst_ptr);

/*The following definitions come from  rfcomm_ue_api.c  */

t_api RDABT_RFCOMM_UE_Register_Server(rdabt_t_rfcomm_schan schan, struct rdabt_rfcomm_dlc_cb *dlc_cbs);
t_api RDABT_RFCOMM_UE_Deregister_Server(rdabt_t_rfcomm_schan schan);
t_api RDABT_RFCOMM_UE_Set_Channel_Open(rdabt_t_rfcomm_schan schan);
t_api RDABT_RFCOMM_UE_Set_Channel_Closed(rdabt_t_rfcomm_schan schan);
t_api RDABT_RFCOMM_UE_Get_Channel_State(rdabt_t_rfcomm_schan schan);
t_api RDABT_RFCOMM_UE_Start_Req(t_bdaddr bd_addr, rdabt_t_rfcomm_start_sys_params *system_parameters, struct rdabt_rfcomm_multi_cb *callbacks, void **multi_inst);
t_api RDABT_RFCOMM_UE_Start_Resp(t_bdaddr bd_addr, rdabt_t_rfcomm_start_sys_params *system_parameters, rdabt_t_rfcomm_accept accept,  struct rdabt_rfcomm_multi_cb *callbacks, void *multi_inst);
t_api RDABT_RFCOMM_UE_register_rfstart_ind_cb(int (*RDABT_RFCOMM_UE_Start_Ind_cb)(t_bdaddr, rdabt_t_rfcomm_start_sys_params *, rdabt_t_rfcomm_accept, void *));
t_api RDABT_RFCOMM_UE_DLC_Estab_Req(t_bdaddr bd_addr, rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_dlc_params *dlc_params, struct rdabt_rfcomm_dlc_cb *callbacks, void *multi_inst);
t_api RDABT_RFCOMM_UE_DLC_Estab_Resp(t_bdaddr bd_addr, rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_dlc_params *dlc_params, rdabt_t_rfcomm_accept accept, void *multi_inst);
t_api RDABT_RFCOMM_UE_DLC_Rel_Req(rdabt_t_rfcomm_dlci dlci, void *multi_inst);
t_api RDABT_RFCOMM_UE_Close_Req(void *multi_inst);
t_api RDABT_RFCOMM_UE_Test_Req(rdabt_host_buf_t *frame, void *multi_inst);
t_api RDABT_RFCOMM_UE_Flow_Req(rdabt_t_rfcomm_flow_state state, void *multi_inst);
t_api RDABT_RFCOMM_UE_Data_Req(rdabt_t_rfcomm_dlci dlci, rdabt_host_buf_t *buffer, void *multi_inst);
t_api RDABT_RFCOMM_UE_Portneg_Req(rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_port_params *port_parameters, void *multi_inst);
t_api RDABT_RFCOMM_UE_Portneg_Resp(rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_port_params *port_parameters, rdabt_t_rfcomm_accept accept, void *multi_inst);
t_api RDABT_RFCOMM_UE_Control_Req(rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_control_params *control_params, void *multi_inst);
t_api RDABT_RFCOMM_UE_Linestatus_Req(rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_line_stat_params line_stat_params, void *multi_inst);
t_api RDABT_RFCOMM_UE_Parneg_Req(rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_dlc_params *dlc_params, void *multi_inst);
t_api RDABT_RFCOMM_UE_Parneg_Resp(rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_dlc_params *dlc_params, rdabt_t_rfcomm_accept accept, void *multi_inst);
t_api RDABT_RFCOMM_UE_Get_Multiplexer_State(t_bdaddr bd_addr, void **multi_inst);
t_api RDABT_RFCOMM_UE_Parneg_Credit_Req(rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_dlc_params *dlc_params, u_int8 init_credits, void *multi_inst);
t_api RDABT_RFCOMM_UE_Parneg_Credit_Resp(rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_dlc_params *dlc_params, rdabt_t_rfcomm_accept accept, u_int8 init_credits, void *multi_inst);
t_api RDABT_RFCOMM_UE_Set_Credit_Mode(rdabt_t_rfcomm_dlci dlci, u_int8 auto_credit_issue, void *multi_inst);
t_api RDABT_RFCOMM_UE_Issue_Credits(rdabt_t_rfcomm_dlci dlci, u_int8 num_credits, void *multi_inst);

t_api __rdabt_rfcomm_ue_Parneg_Credit_Req(rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_dlc_params *dlc_params, u_int8 init_credits, void *multi_inst, u_int8 locking);
t_api __rdabt_rfcomm_ue_Parneg_Req(rdabt_t_rfcomm_dlci dlci, rdabt_t_rfcomm_dlc_params *dlc_params, void *multi_inst, u_int8 locking);
t_api RDABT_RFCOMM_UE_Get_Write_Buffer(t_bdaddr bd_addr, rdabt_t_rfcomm_dlci dlci, u_int16 frame_size, u_int32 flags, rdabt_host_buf_t **frame);
t_api RDABT_RFCOMM_UE_Release_Write_Buffer(rdabt_host_buf_t *frame);

t_api rdabt_rfcomm_credit_peer_nocredit(struct rdabt_rfcomm_dlc_inst *self);

t_api rdabt_rfcomm_dlci0_lock_and_transmit_cmesg(struct rdabt_rfcomm_l2cap_inst *self, rdabt_host_buf_t *buffer, u_int8 cresp);

#endif /* _PROTO_H_ */
